<script setup>
defineProps({
  /** ElementPlus */
  value: { type: String, default: '' },
  type: { type: String, default: 'date' },
  placeholder: { type: String, default: '请选择日期' },
  disabledDate: { type: Function, default: () => null },
  shortcuts: { type: Array, default: () => [] },
  readonly: Boolean,
  disabled: Boolean,
  size: { type: String, default: 'default' },
  format: { type: String, default: 'YYYY-MM-DD' },
  valueFormat: { type: String, default: 'YYYY-MM-DD' },
  popperClass: { type: String, default: '' },
  rangeSeparator: { type: String, default: '~' },
  editable: { type: Boolean, default: true },
  clearable: { type: Boolean, default: true }
})
const emit = defineEmits(['change'])

const changeDatePicker = (value) => {
  emit('change', value)
}
</script>

<template>
  <el-date-picker
    :model-value="value"
    :type="type"
    :placeholder="placeholder"
    :size="size"
    :disabled-date="disabledDate"
    :shortcuts="shortcuts"
    :readonly="readonly"
    :disabled="disabled"
    :format="format"
    :value-format="valueFormat"
    :popper-class="popperClass"
    :range-separator="rangeSeparator"
    start-placeholder="开始日期"
    end-placeholder="结束日期"
    @change="changeDatePicker"
  >
  </el-date-picker>
</template>
